#pragma once
#include <iostream>
#include <fstream>
#include <string>
#include <gpiod.hpp> // Make sure to link against libgpiodcxx (C++ bindings)

int writeToFile(const std::string& path, const std::string& value);

class Servo
{
private:
    /* data */
public:
    Servo();
    ~Servo();
    int setspeed(int speed);
};

class Ledlight
{
private:
    /* data */
public:
    Ledlight();
    ~Ledlight();
    int setbright(int brightness);
};

class Step
{
private:
    /* data */
public:
    Step();
    ~Step();
    int enable(bool enable);
    int setdir(bool dir);
    int setspeed(int speed);
};

class Limitation
{
private:
    gpiod::line line_;
    int Last_status=0;
public:
    Limitation(int chip_num, int line_num);
    ~Limitation();
    int getLimitation();
};

class Driver{
private:
    /* Data */
public:
    Servo servo;
    Step step;
    Ledlight LED;
    Limitation LitSW_L;
    Limitation LitSW_R;
    Driver();
    ~Driver();
};
extern Driver driver;
